<?php if(!empty($oGallery) && !empty($oGallery['photos'])): ?>
<div class="slider">
	<ul class="slides">
        <?php foreach($oGallery['photos'] as $oPhoto): ?>
		<li class="slide">
            <?php if(!empty($oPhoto['title'])): ?>
            <div class="st"><?php echo $oPhoto['title']; ?></div>
            <?php endif; ?>
            <img alt="<?php echo $oPhoto['title']; ?>" title="<?php echo $oPhoto['title']; ?>" src="<?php echo $this->widget('ext.Img', array(
                'oRow' => $oPhoto,
                'size' => '',
                'addSize' => false
                )); ?>" />
        </li>
        <?php endforeach; ?>
	</ul>
</div>
<?php endif; ?>

<?php
if(!empty($oCategories)): ?>
<div class="main-categories">
    <?php $index = 0; foreach($oCategories as $oRow): $index++; ?><!--
        --><a class="section" href="<?php echo $this->createUrl('/goods/default/index/', array('category_id' => $oRow->createUrlId())); ?>">
            <?php if($oRow->getPhoto()): ?>
            <figure>
                <img alt="<?php echo $oRow->title; ?>" title="<?php echo $oRow->title; ?>" src="<?php echo $oRow->getPhoto()->path .''. $oRow->getPhoto()->file; ?>" />
            </figure>
            <?php endif; ?>
			<div class="title"><?php echo $oRow->title; ?></div>
        </a><!--
    --><?php endforeach; ?>
	<div class="clear"></div>
</div>
<?php endif; ?>

<?php
if(!empty($oTop)): ?>
	<div class="top-goods">
		<h2 class="title"><?php echo _('Самые покупаемые товары'); ?></h2>
		<div class="clear"></div>
		<div class="slider">
			<ul class="slides">
				<li class="slide">
			<?php $index = 0; foreach($oTop as $oRow): $index++; ?><!--
	        --><section class="item">
					<?php if($oRow->getPhoto()): ?>
						<figure>
							<a class="img" href="<?php echo $this->createUrl('/goods/default/view/', array('category' => $oRow->category_alias, 'id' => $oRow->createUrlId())); ?>">
								<img alt="<?php echo $oRow->title; ?>" title="<?php echo $oRow->title; ?>" src="<?php echo $this->widget('ext.Img', array('oRow' => $oRow->getPhoto(), 'size' => 'list')); ?>" />
							</a>
						</figure>
					<?php endif; ?>

					<div class="title">
						<a href="<?php echo $this->createUrl('/goods/default/view/', array('id' => $oRow->alias, 'category' => $oRow->category_alias)); ?>"><?php echo $oRow->title; ?></a>
					</div>
					<p class="price"><?php echo Currencies::convert($oRow->price); ?></p>
					<?php if($oRow->old_price > 0): ?>
						<p class="was"><span><?php echo Currencies::convert($oRow->old_price); ?></span> <span><?php echo _('знижка'); ?> <?php echo round($oRow->price / $oRow->old_price * 100) ?>%</span></p>
					<?php endif; ?>
				</section>
			<?php
				echo ($index >= 4 && $index % 4 == 0 && $index != count($oTop)) ? ' </li><li class="slide">' : '';
				echo ($index == count($oTop)) ? ' </li>' : '';
			?><?php endforeach; ?>
			</ul>
		</div>
	</div>
<?php endif; ?>
